<?php namespace App\Exceptions;
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/8/5
 * Time: 23:48
 */
use Exception ;

/**
 * Class InvestorAuthException           处理投资人信息认证异常
 * @package App\Exceptions
 */
class InvestorAuthException extends Exception{
    /**
     * 参数定义
     * NoinvestInfoId               表示投资者信息id
     * InvestInfoAuthIsFails        表示已经认证过了但是认证不成功
     * InvestInfoAuthIsPasses       表示已经认证过了但是认证成功
     */
    const NoInvestorId = 0x01;
    const InvestorAuthIsFails = 0x02;
    const InvestorAuthIsPasses = 0x03;


    public function __construct($code, array $data = [], Exception $previous = null)
    {
        switch ($code) {
            case self::NoInvestorId:
                $message = trans('exception.investor_auth.no_invest_info_id', ['id' => array_get($data, 'id')]);
                break;
            case self::InvestorAuthIsFails:
                $message = trans('exception.investor_auth.invest_info_auth_fails');
                break;
            case self::InvestorAuthIsPasses:
                $message = trans('exception.investor_auth.invest_info_auth_passes');
                break;
            default:
                $message = trans('general.unknown_exception');
                break;
        }

        parent::__construct($message, $code, $previous);
    }
}